<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/include/page.jsp"%>
<jsp:useBean id="pojo" class="com.jjh.users.pojo.AAdmins"/>
<!DOCTYPE HTML>
<html>
	<head>
		<%@ include file="/common/include/title.jsp"%>
		<link rel="stylesheet" href="${rootPath }/common/resource/H-ui.admin/lib/zTree/v3/css/zTreeStyle/zTreeStyle.css"
		type="text/css">
		<title>菜单列表 - 用户中心</title>
	</head>
	<body>
		<nav class="breadcrumb">
			<i class="Hui-iconfont">&#xe67f;</i> 首页
			<span class="c-gray en">&gt;</span> 用户管理
			<span class="c-gray en">&gt;</span> 菜单(树形)列表
			<a class="btn btn-success radius r" style="line-height: 1.6em; margin-top: 3px"
				href="javascript:location.replace(location.href);" title="刷新">
				<i class="Hui-iconfont">&#xe68f;</i>
			</a>
		</nav>
		<table class="table">
			<tr>
				<td width="200" class="va-t">
					<ul id="treeDemo" class="ztree"></ul>
				</td>
				<td class="va-t">
					<iframe ID="testIframe" Name="testIframe"
						FRAMEBORDER=0 SCROLLING=AUTO width=100% height=390px
						SRC="http://www.baidu.com"></iframe>
				</td>
			</tr>
		</table>
		<%@ include file="/common/include/footer.jsp" %>
		<!--请在下方写此页面业务相关的脚本-->
		<script type="text/javascript"
			src="${rootPath }/common/resource/H-ui.admin/lib/zTree/v3/js/jquery.ztree.all-3.5.min.js"></script>
		<script type="text/javascript">
			var setting = {
				view : {
					dblClickExpand : true,
					showLine : true,
					selectedMulti : false
				},
				data : {
					simpleData : {
						enable : true,
						idKey : "id",
						pIdKey : "pId",
						rootPId : ""
					}
				},
				callback : {
					beforeClick : function(treeId, treeNode) {
						var zTree = $.fn.zTree.getZTreeObj("tree");
						if (treeNode.isParent) {
							zTree.expandNode(treeNode);
							return false;
						} else {
							demoIframe.attr("src", treeNode.file + ".html");
							return true;
						}
					}
				}
			};
			
			/* 超级关键,它是内容 */
			var zNodes = 
			[ 
				<c:forEach items="${requestScope.list}" var="listTemp" varStatus="stat">
					{
						id : ${listTemp.id} ,
						pId : ${listTemp.parentId},
						name : "${listTemp.name}",
						open : true ,
					},
				</c:forEach>
			];
			
			var code;
	
			function showCode(str) {
				if (!code)
					code = $("#code");
				code.empty();
				code.append("<li>" + str + "</li>");
			}
	
			$(document).ready(function() {
				var t = $("#treeDemo");
				t = $.fn.zTree.init(t, setting, zNodes);
				demoIframe = $("#testIframe");
				//demoIframe.on("load", loadReady);
				var zTree = $.fn.zTree.getZTreeObj("tree");
				//zTree.selectNode(zTree.getNodeByParam("id",'11'));
			});
		</script>
	</body>
</html>